package com.dd.service.impl;

import com.dd.entity.PurchaseSettlement;
import com.dd.entity.PurchaseSettlementSuppliersVO;
import com.dd.mapper.PurchaseSettlementMapper;
import com.dd.service.IPurchaseSettlementService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 采购结算表 服务实现类
 * </p>
 *
 * @author dhd
 * @since 2024-10-21
 */
@Service
public class PurchaseSettlementServiceImpl extends ServiceImpl<PurchaseSettlementMapper, PurchaseSettlement> implements IPurchaseSettlementService {
    @Autowired
    PurchaseSettlementMapper purchaseSettlementMapper;

    @Override
    public int insertInto(PurchaseSettlement purchaseSettlement) {
        return purchaseSettlementMapper.insertBatch(purchaseSettlement);
    }

    @Override
    public PageInfo<PurchaseSettlementSuppliersVO> selectPurchaseSettlementSuppliers(int pageNum) {
        PageHelper.startPage(pageNum,5);
        List<PurchaseSettlementSuppliersVO> purchaseSettlementSuppliers = purchaseSettlementMapper.selectPurchaseSettlementSuppliers();
        PageInfo<PurchaseSettlementSuppliersVO> pageInfo = new PageInfo<>(purchaseSettlementSuppliers);
        return pageInfo;
    }

    @Override
    public int updateStatus(String poId, int supplierId) {
        return purchaseSettlementMapper.updateStatus(poId,supplierId);
    }
}
